package com.cskaoyan.service;

import com.cskaoyan.dao.OrderDao;
import com.cskaoyan.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

//@Component
//@Service //组件id → userServiceImpl
//@Service(value = "userService")
@Service("userService") //如果注解中只有一个value属性，“value=”是可以省略不写
public class UserServiceImpl implements UserService{

    @Autowired
    @Qualifier("userDaoImpl")
    UserDao userDao1;
    @Resource(name = "userDaoImpl2")
    UserDao userDao2;
    @Autowired
    OrderDao orderDao;

    @Value("${user.username}")
    String username;

    @Override
    public void sayHello() {
        System.out.println("hello annotation");
    }
}
